package com.gitee.wsl.compose.ui.base

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowColumnScope
import androidx.compose.foundation.layout.FlowRowScope
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ListItemColors
import androidx.compose.material3.ListItemDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp

object Layout

/**
 * BadgedBox(
 *             badge = {
 *                 if (itemCount > 0) {
 *                     Badge(
 *                         containerColor = Color.Red,
 *                         contentColor = Color.White
 *                     ) {
 *                         Text("$itemCount")
 *                     }
 *                 }
 *             }
 *         )
 */
@Composable
@OptIn(ExperimentalMaterial3Api::class)
fun Layout.BadgedBox(badge: @Composable BoxScope.() -> Unit,
                     modifier: Modifier = Modifier,
                     content: @Composable BoxScope.() -> Unit)
 = androidx.compose.material3.BadgedBox(badge, modifier, content)

@Composable
fun Layout.ListItem(
    headlineContent: @Composable () -> Unit,
    modifier: Modifier = Modifier,
    overlineContent: @Composable (() -> Unit)? = null,
    supportingContent: @Composable (() -> Unit)? = null,
    leadingContent: @Composable (() -> Unit)? = null,
    trailingContent: @Composable (() -> Unit)? = null,
    colors: ListItemColors = ListItemDefaults.colors(),
    tonalElevation: Dp = ListItemDefaults.Elevation,
    shadowElevation: Dp = ListItemDefaults.Elevation,
) = androidx.compose.material3.ListItem(headlineContent, modifier, overlineContent, supportingContent, leadingContent, trailingContent, colors, tonalElevation, shadowElevation)
